
for (var xx=0; xx<20; xx++)
for (var yy=0; yy<20; yy++)
{
    var obj = map_grid[xx, yy];
    with(obj)
    {
        dist = point_distance(x,y, obj_player.x, obj_player.y);
        if(dist < 100)
        {
            color = merge_color(c_white, c_black, dist/100);
            //d
            px = x + 8;
            py = y + 8;
            
            //d
            if(collision_line(px,py,obj_player.x, obj_player.y, obj_block, 0, true))
            {
                drawable = false;
            }
        }
        else drawable = false;
    }
}
if (!keyboard_check(ord("R")))
with(obj_block)
{
    if(!drawable)
    {
        for(var i=-1; i<= 1; i++)
        {
            if( i != 0)
            {
                var xx = median( 0, 19, cellx+i);
                var inst = obj_camera.map_grid[xx, celly];
                if(inst.object_index == obj_floor)
                if(inst.drawable)
                {
                    drawable=true;
                }
            }
        }
        
       for(var j=-1; j<= 1; j++)
        {
            if( j != 0)
            {
                var yy = median( 0, 19, celly+j);
                var inst = obj_camera.map_grid[cellx, yy];
                if(inst.object_index == obj_floor)
                if(inst.drawable)
                {
                    drawable=true;
                }
            }
        }
    }
}
if (!keyboard_check(ord("T")))
with(obj_floor)
{
    if(!drawable)
    {
        if(dist < 100)
        {
            for(var i=-1; i<= 1; i++)
            {
                if( i != 0)
                {
                    var xx = median( 0, 19, cellx+i);
                    var inst = obj_camera.map_grid[xx, celly];
                    if(inst.drawable)
                    if(inst.object_index == obj_floor)
                    if(color_get_value(inst.color) > 100)
                    {
                        color = merge_color(c_black, inst.color, 0.2);
                        drawable = true;
                    }
                }
            }
            
           for(var j=-1; j<= 1; j++)
            {
                if( j != 0)
                {
                    var yy = median( 0, 19, celly+j);
                    var inst = obj_camera.map_grid[cellx, yy];
                    if(inst.drawable)
                    if(inst.object_index == obj_floor)
                    if(color_get_value(inst.color) > 100)
                    {
                        color = merge_color(c_black, inst.color, 0.2);
                        drawable = true;
                    }
                }
            }
           }
    }
}
